package com.utopia.keyvalue.store.impl.disk;

import com.utopia.keyvalue.store.Storage;
import com.utopia.keyvalue.store.StorageTest;

/**
 * @author yanjiaqiang
 * @date 2011-3-22
 * @version $Id: DiskStorageTest.java 5 2011-03-22 09:23:42Z JiaqiangYan@gmail.com $
 */
public class DiskStorageTest extends StorageTest {

	@Override
	public Storage newStorage() {
		return new DiskHashStorage();
	}

	@Override
	public void testPersistence() {
		testFunction();
		Storage storage = newStorage();
		for (int i = 0; i < 1000; i++) {
			byte[] value = storage.get(i + "");
			assertEquals(new String(value), (i + ""));
		}
		storage.remove("1");
		assertNull(storage.get("1"));
		storage.close();

	}

}
